﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VINETLIFE.BL;
using VINETLIFE.DO;

namespace VINETLIFE.AdminCP
{
    public partial class ListBusinessPartner : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            tlPartnerType.DataSource = new cmsPartnerTypeBL().SelectAll();
            lblTitle.Text = "List Business Partner";
            tlPartnerType.DataBind();
            tlPartnerType.ExpandToLevel(3);


        }

        protected void tlPartnerType_StartNodeEditing(object sender, DevExpress.Web.ASPxTreeList.TreeListNodeEditingEventArgs e)
        {
            int id = 0;
            if (int.TryParse(tlPartnerType.EditingNodeKey, out id))
            {
                Response.Redirect("BusinessPartner.aspx?PartnerTypeId=" + id.ToString());
            }
        }

        protected void tlPartnerType_NodeDeleted(object sender, DevExpress.Web.Data.ASPxDataDeletedEventArgs e)
        {
            new cmsPartnerTypeBL().Delete(new cmsPartnerTypeDO() { PartnerTypeId = int.Parse(tlPartnerType.FocusedNode.Key) });
            Response.Redirect(Request.Url.ToString());
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Response.Redirect("BusinessPartner.aspx");
        }
    }
}